package com.palm.web.util;

import java.util.List;

public class Polygon {
	
	private List<Point> points;
	private boolean pointInPolygon(Point point) {

		int i, j = points.size() - 1;
		boolean oddNodes = false;

		for (i = 0; i < points.size(); i++) {
			if ((points.get(i).getLatitude() < point.getLatitude() && points.get(j).getLatitude() >= point.getLatitude()
					|| points.get(j).getLatitude() < point.getLatitude()
							&& points.get(i).getLatitude() >= point.getLatitude())
					&& (points.get(i).getLongitude() <= point.getLongitude()
							|| points.get(j).getLongitude() <= point.getLongitude())) {
				if (points.get(i).getLongitude() + (point.getLatitude() - points.get(i).getLatitude())
						/ (points.get(j).getLatitude() - points.get(i).getLatitude())
						* (points.get(j).getLongitude() - points.get(i).getLongitude()) < point.getLongitude()) {
					oddNodes = !oddNodes;
				}
			}
			j = i;
		}

		return oddNodes;
	}
}
